(function(){

var defaultOptions = {
    defaultValue: new Array(32).fill(0)
};
$.fn.leds = function(options){
    var _t = this;
    options = $.extend({}, defaultOptions, options);
    //当前值
    var value;

    this.setValue = function(array){
        var _value = array.join('');
        if(_value === value) return;
        value = _value;

        requestAnimationFrame(function(){
            var background = array.map(function(num){
                    return 'url(./images/led-' + num + '.png)';
                }).join(',');
            _t.css('background-image', background);
        });
    };

    this.setValue(options.defaultValue);
    return this;
};

})();